﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace sy3_5
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            float distance = float.Parse(textBox1.Text);

            // 创建里程计算对象
            CountDistance cd = new CountDistance();
            cd.Distance = distance;

            // 显示结果
            MessageBox.Show($"您的汽车已经行驶 {CountDistance.TotalDistance} 公里");
        }
    }
}
